/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"2265458A-8145-4E65-B658-012DAE0604C0"}
 */
function nuevo(event) {
	tablas_cab_to_tablas_dtl.newRecord()
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"3AA082F6-DBA6-424B-9DC8-C736DAEC718A"}
 */
function borrar(event) {
	if (globals.DIALOGS.showQuestionDialog('Confirma','¿Seguro desea borrar este registro?','Si','No') == 'Si')
	{
		tablas_cab_to_tablas_dtl.deleteRecord()
	}
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @private
 *
 *
 * @properties={typeid:24,uuid:"F2A0ECBC-8D79-4E23-BFFC-22919898F8D6"}
 */
function aceptar(event) {
	if (databaseManager.saveData())
	{
		databaseManager.setAutoSave(true)
		var $win = application.getWindow('ALTA_TABLAS')
		$win.hide()
		$win.destroy()
	}
	else
	{
		globals.DIALOGS.showErrorDialog('Error','Ocurrio un error','OK')
	}
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @private
 *
 *
 * @properties={typeid:24,uuid:"75DD8355-CA90-444E-9320-42F35A556D7F"}
 */
function cancelar(event) {
	databaseManager.revertEditedRecords()
	databaseManager.setAutoSave(true)
	var $win = application.getWindow('ALTA_TABLAS')
	$win.hide()
	$win.destroy()
}

/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @private
 *
 * @properties={typeid:24,uuid:"E7725A58-B595-473D-9E96-4EF307DF38CE"}
 */
function onShow(firstShow, event) {
	elements.fld_comentarios.requestFocus()
}
